#include "core/stockmodel.h"
#include "core/transactionmodel.h"

StockModel::StockModel()
{
    this->item = new ItemModel;
    this->serial = "TPX220-Ci5SB-F16";
    this->priceSold = -1.0f;
}

StockModel::~StockModel()
{
    delete this->item;
}

ItemModel *StockModel::getItem()
{
    return this->item;
}

void StockModel::setItem(ItemModel * item)
{
    this->item = item;
}

QString StockModel::getSerial()
{
    return this->serial;
}

void StockModel::setSerial(QString serial)
{
    this->serial = serial;
}

bool StockModel::isSold()
{
    if (this->priceSold >= 0.0f) {
        return true;
    }

    return false;
}

float StockModel::getSellPrice()
{
    return this->priceSold;
}

void StockModel::setSellPrice(float sellPrice)
{
    this->priceSold = sellPrice;
}

int StockModel::getTransactionId()
{
    return this->transactionID;
}

void StockModel::setTransactionId(int id)
{
    this->transactionID = id;
}

void StockModel::setTransaction(TransactionModel *transaction)
{
    this->transactionID = transaction->getID();
}
